package com.example.permission.myjbm.dao;


import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.jbmsuppliers.sinopec.view.DoubleButtonDialog;

/**
 * Created by JBMhaier on 2017/1/17.
 */

public abstract class BaseFgm extends Fragment {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        return super.onCreateView(inflater, container, savedInstanceState);
    }
    //检测网络是否连接
    public  boolean isNetworkConnected() {
        if (getActivity() != null) {
            ConnectivityManager mConnectivityManager = (ConnectivityManager) getActivity()
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();
            if (mNetworkInfo != null) {
                return mNetworkInfo.isAvailable();
            }
        }
        return false;
    }

    //提示
    public    void hint(String name) {
        final DoubleButtonDialog dialog = new DoubleButtonDialog(
                getActivity(), name);
        dialog.getokbtn().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                dialog.dismiss();

            }
        });
        dialog.setisVisibility();

    }

}
